#lang racket

(define (mult a b) (mult-iter a b 1 b a 0))

(define (mult-iter a b mult rem r acc)
  (cond ((> mult b) acc)
        ((= (remainder rem 2) 1) (mult-iter a b (+ mult mult) (floor (/ rem 2)) (+ r r) (+ acc r)))
        (else (mult-iter a b (+ mult mult) (floor (/ rem 2)) (+ r r) acc))))

(mult 2 7)